#include "pthread.h"
#include "error.h"

int Wrap::pthread_attr_init_(pthread_attr_t *attr)
{
    return PERROR_NEQ0(::pthread_attr_init(attr));
}

int Wrap::pthread_create_(
    pthread_t *newthread, const pthread_attr_t *attr, 
    void *(*startRoutine)(void *), void *arg)
{
    return PERROR_NEQ0(::pthread_create(newthread, attr, startRoutine, arg));
}

void Wrap::pthread_exit_(void *retval) {
    ::pthread_exit(retval);
}

void *Wrap::pthread_getspecific_(pthread_key_t key)
{
    return ::pthread_getspecific(key);
}

int Wrap::pthread_key_create_(pthread_key_t *key, void (*destrFunctioin)(void *))
{
    return PERROR_NEQ0(::pthread_key_create(key, destrFunctioin));
}

int Wrap::pthread_key_delete_(pthread_key_t key)
{
    return ::pthread_key_delete(key);
}

pthread_t Wrap::pthread_self_()
{
    return ::pthread_self();
}

int Wrap::pthread_setaffinity_np_(pthread_t th, size_t cpusetsize, const cpu_set_t *cpuset)
{
    return PERROR_NEQ0(::pthread_setaffinity_np(th,  cpusetsize, cpuset));
}

int Wrap::pthread_setspecific_(pthread_key_t key, const void *pointer)
{
    return PERROR_NEQ0(::pthread_setspecific(key, pointer));
}
